The present invention relates to industrial controllers used for real-time control of industrial processes and in particular to a method of synchronizing clocks among multiple industrial controllers connected by a network, wherein the synchronizing method is applicable to a wide variety of different network protocols.
Industrial controllers are special-purpose computers used for controlling industrial processes and manufacturing equipment. Under the direction of a stored program, the industrial controller examines a series of inputs reflecting the status of the controlled process and changes the series of outputs controlling the industrial process. The inputs and outputs may be binary, that is on or off, or analog providing a value within a continuous range of values.
An industrial controller differs from a conventional computer in that the various components of the industrial controller may be separated by a considerable distance commensurate with the expanse of a large factory or manufacturing operation. Separated industrial controllers communicate via digital messages transmitted over one or more communication networks including well-known standards of EtherNet, DeviceNet, ControlNet, Fire Wire, Field Bus, SERCOS and ATM. Each of these networks employs different communication protocols. Inter-communication among industrial controllers using different standards is facilitated by the availability of application-specific integrated circuits (ASIC) providing for low-level formatting and queuing operations necessary to interface to the communication media
The networks between industrial controllers necessarily introduce a delay in the communication between controllers depending on the distance between controllers and the amount of message traffic. In order to reduce this delay, time critical messages may be assigned a high priority on the network, where high priority messages obtain use of the shared communication media in preference to low priority messages.
Normally, even high priority message experience some delay both because of the competition between high priority messages and because the proportion of message carrying capacity of the communication network allocated to high priority messages is limited to ensure that low priority messages will also be guaranteed transmission. As a result, extremely accurate timing of control actions at a remote industrial controller cannot be obtained.
It is known to moderate the effects of network delay on the timing of control actions by providing each industrial controller with an accurate local clock to which control activities may be synchronized across the entire network of controllers. A control event may be linked to a particular time and transmitted in a control message to the industrial controller in advance of the time the control event must be performed. The actual execution of the control event is then triggered by the local clock of each controller without concern about the time of receipt of the control message.
Likewise, data being accepted by a given controller may be xe2x80x9ctime stampedxe2x80x9d with the value of the controller""s clock so that the data""s precise time of arrival may be determined by another controller, even though the message transmitting the data to the other controller may be delayed.
For these approaches to be successful, the local clocks used by the networked industrial controllers must be synchronized precisely with each other. This can be done by transmitting from one master clock a time message holding a time value to which the other clocks will be synchronized. Unfortunately the time message is subject to the same network induced delays as the control messages. These significant and unpredictable delays will be reflected in errors in synchronization between local clocks.
One method of addressing the effects of network delay on delaying the transmission of the time message is to place the time value of the master clock in the time message the moment the time message is transmitted on the network""s physical medium. In this way all network delay caused by queuing of the time message with other messages is eliminated and the local clocks can be synchronized within the error caused by the relatively short propagation delay on the physical media.
Unfortunately, such an xe2x80x9con-the-flyxe2x80x9d modification of the time message to reflect the current master clock time value is difficult. As mentioned above, the task of preparing a message for transmission is usually performed by a specialized integrated circuit which may not include this capability. A time synchronization system which requires fundamental changes in standard hardware will be difficult and costly to implement for multiple networks.
What is needed is a method of synchronizing local clocks among industrial controllers that are connected by a variety of standard communication networks.
The present invention avoids the need to modify standard ASICs used for network communication among industrial controllers and largely eliminates the effect of delay in the transmission of the time message by use of a global synchronously transmitted reference pulse followed later by a linked time message. The reference pulse, which carries with it no explicit time value, may be a xe2x80x9cheartbeatxe2x80x9d signal used in many communication protocols or may be an external pulse derived from a system such as global positioning satellites. The time message then provides the time value of the reference pulse. All industrial controllers record the time values of their local clocks upon the occurrence of the reference pulse, then upon receipt of the time message, adjust their local clocks according to the difference between the time value of the time message and the recorded time of the reference pulse. By separating the reference pulse from the time message, conventional messaging may be used for transmission of the time message without concern about its delay.
Specifically, the present invention provides a method of synchronizing local clocks among industrial controllers communicating on a network to a time value of a master clock in a first industrial control device. The method includes the steps of detecting at the first industrial controller a global reference pulse and storing the time value of the master clock. This time value is then transmitted by the first industrial controller as a time message on the network to the other industrial controllers. A second industrial controller also detects the global reference pulse and stores a value of its local clock at that time. It then receives the time message from the first industrial controller and compares its stored local time with the time value of the time message to deduce an error value. This error value is used to correct the clock of the second industrial controller.
Thus, it is one object of the invention to provide a method of synchronizing local clocks that is indifferent to arbitrary delays introduced by communication protocols in the transmission of time messages. Communication of the global reference pulse outside of the messaging framework frees it from delays inherent in the messaging process. Separating the time value from the reference pulse allows the time value to be communicated separately at an arbitrary time later so as to accommodate the variable delays.
It is another object of the invention to provide a time synchronization system that works well with pre-existing communication standards. Many network protocols include a heartbeat signal transmitted independently of messages at a regular time over the entire network. This heartbeat signal may be used as the global reference pulse subject only to minor propagation delays in the communication media of the network. Alternatively, the global reference pulse may come from a source external to the industrial controllers and independent of their time values. Any periodic signal that may be received by all industrial controllers, for example a reference signal of a global positioning satellite, may be used.
The industrial controllers may include a snapshot register communicating with the local clock of the industrial controller and triggered by detection of the global reference pulse.
Thus it is another object of the invention to provide for extremely rapid acquisitions of time values at a hardware level. Unlike the processing of messages which necessarily proceeds through the ASIC, the reference pulse may be received without delay to trigger the acquisition of a time value by the snapshot register. The snapshot register may be then read at an arbitrary time later allowing the comparison process of the present invention, by which an error value is determined to be performed at a later time by relatively slow speed software.
Generally, the global reference pulse will reoccur at a regular period and the time message will be sent within the one period from occurrence of the global reference pulse. In this way, the linkage of the global reference pulse and the time value of the time message are implicit with each time value referring to the previous global reference pulse measurement.
Thus, it is one object of the invention to provide for an extremely simple linkage of time values and time markers.
Alternatively, the global reference pulse may include a pulse identification code uniquely identifying the global reference pulse among a series of global reference pulses and the time message may include both a time value and a pulse identification code corresponding to the particular global identification pulse with which it is associated. The received time message is then compared at a second industrial controller only to the time value corresponding to a global reference pulse having a pulse identification code corresponding to that contained in the time message.
Thus, it is another object of the invention to accommodate global synchronizing pulses that occur far more frequently than transmission of the time messages or situations where the uncertainty in transmission of the time messages may exceed the periodicity of the global synchronizing pulse.
The foregoing and other objects and advantages of the invention will appear from the following description. In the description, reference is made to the accompanying drawings which form a part hereof and in which there is shown by way of illustration a preferred embodiment of the invention. Such embodiment does not necessary represent the full scope of the invention, however, and reference must be made to the claims herein for interpreting the scope of the invention.